-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add bulk Telegram campaigns #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…positional argument to options object
- Add bulk processing support to sendTelegram method - Support ProcessBulkRequestResponse with tasks array - Add prepareBulkRequest integration with dataprotector SDK - Update types to support bulk orders and responses - Add unit tests for bulk processing scenarios - Add e2e test for bulk telegram sending - Update IExecWeb3telegram to use dataprotector instance - Fix IPFS config to use ipfsGatewayURL and ipfsNodeURL - Handle union types (SendTelegramSingleResponse | ProcessBulkRequestResponse) - Add tests for bulk operations with allowBulk access grants
- Change iexec from 8.20.0-feat-bulk-processing-62e7c5f to exact version - Update package-lock.json with resolved dependencies - Clean up nested dependencies structure
- Remove PrepareBulkRequestResponse import (no longer needed) - Replace bulkRequest with grantedAccess array parameter - Make protectedData optional (required only for single processing) - Add maxProtectedDataPerTask parameter - Update SendTelegramParams documentation
- Add bulkOnly optional parameter to filter contacts with bulk access - Pass bulkOnly parameter to fetchDatasetOrderbook calls - Support filtering orders by bulk access capability - Default value is false (returns all contacts)
…equest - Replace bulkRequest parameter with grantedAccess array - Make protectedData optional (required only for single processing mode) - Restructure logic: bulk processing vs single processing - Call prepareBulkRequest before processBulkRequest when grantedAccess provided - Move protectedData validation to single processing mode only - Improve separation of concerns between bulk and single processing
- Replace bulkRequest with grantedAccess parameter - Remove unused prepareBulkRequest call (now internal to sendTelegram) - Add maxProtectedDataPerTask parameter - Make protectedData optional in test call
…o sdk-publish-npm.yml
- Update @iexec/dataprotector from 2.0.0-beta.20-feat to ^2.0.0-beta.21 - Update iexec from 8.20.0-feat to ^8.22.0
- Replace bulkOrders with bulkAccesses in prepareBulkRequest calls - Add ProcessBulkRequestParams type argument to ProcessBulkRequestResponse - Fix e2e test to handle expected error when bulk processing is not available on network
b2f74b7 to
4f3512b
Compare
- Updated createAndPublishAppOrders to resolve ENS names before creating app orders - Fixes 'Invalid order signer, must be the resource owner' error in e2e tests - Ensures app orders are created with the correct resolved address
- Updated sendTelegram to properly handle protocol errors by checking isProtocolError flag before creating new WorkflowError - Fixed test to use Web3TelegramWorkflowError instead of WorkflowError from @iexec/dataprotector - Ensures protocol errors are properly detected and re-thrown with isProtocolError flag set
| const isProcessProtectedDataError = | ||
| error instanceof Error && | ||
| error.message === 'Failed to process protected data'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not rely on the error message
import { WorkflowError as DPWorkflowError } from '@iexec/dataprotector"
// ...
const isProcessProtectedDataError =
error instanceof DPWorkflowError;| if ((error as any)?.isProtocolError === true) { | ||
| throw error; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of this code? I can't figure out when this happens.
| it('should re-throw protocol errors without modification', async () => { | ||
| // --- GIVEN | ||
| const mockCampaignRequest: BulkRequest = { | ||
| app: '0x0000000000000000000000000000000000000000', | ||
| appmaxprice: '1000', | ||
| workerpool: '0x0000000000000000000000000000000000000000', | ||
| workerpoolmaxprice: '1000', | ||
| dataset: '0x0000000000000000000000000000000000000000', | ||
| datasetmaxprice: '0', | ||
| params: '{"bulk_cid":"QmV8mtkG5qjAYjMGGkm6AKdXoXSZxfi1Wqbem4uX4oi9QM"}', | ||
| requester: getRandomAddress().toLowerCase(), | ||
| beneficiary: getRandomAddress().toLowerCase(), | ||
| callback: '0x0000000000000000000000000000000000000000', | ||
| category: '0', | ||
| volume: '1', | ||
| tag: '0x0000000000000000000000000000000000000000000000000000000000000000', | ||
| trust: '0', | ||
| salt: '0x0000000000000000000000000000000000000000000000000000000000000000', | ||
| sign: '0x0000000000000000000000000000000000000000000000000000000000000000', | ||
| }; | ||
|
|
||
| const protocolError = new Error('Protocol error'); | ||
| (protocolError as any).isProtocolError = true; | ||
|
|
||
| const mockDataprotector = { | ||
| processBulkRequest: jest | ||
| .fn<() => Promise<any>>() | ||
| .mockRejectedValue(protocolError), | ||
| } as any; | ||
|
|
||
| // --- WHEN & THEN | ||
| await expect( | ||
| sendTelegramCampaign({ | ||
| dataProtector: mockDataprotector, | ||
| workerpoolAddressOrEns: defaultConfig.prodWorkerpoolAddress, | ||
| campaignRequest: mockCampaignRequest, | ||
| }) | ||
| ).rejects.toBe(protocolError); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most looks good, but I still have some concerns with error handling (see open comments); maybe not specific to this PR
No description provided.